﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Lidgren.Network;

namespace CodeGame.Networking
{
    internal class Packet
    {
        public NetConnection sender;

        public virtual bool Validate(NetIncomingMessage msg)
        {
            throw new NotImplementedException();
        }

        public virtual void Handle()
        {
            throw new NotImplementedException();
        }

        protected bool ValidateString(string str)
        {
            if (string.IsNullOrWhiteSpace(str))
            {
                return false;
            }

            return true;
        }

        protected bool ValidateInt(int num)
        {
            return true;
        }

        protected bool ValidateBool(bool tfbool)
        {
            return true;
        }

        protected bool ValidateFloat(bool tffloat)
        {
            return true;
        }

        public Packet Clone()
        {
            Type thisType = this.GetType();
            return (Packet)thisType.Assembly.CreateInstance(thisType.FullName);
        }
    }
}
